package com.yhcui.rabbit.tools;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * 文件相关工具类
 */
public class FileUtils {

    private FileUtils() {

    }

    public static List<String> readFile(String fileName) {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"))) {
            String content = null;
            List<String> result = new ArrayList<>();
            while ((content = reader.readLine()) != null) {
                result.add(content);
            }
            return result;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void main(String[] args) {
        String fileName = "/Users/yuhuicui/tmp/g1_0428.csv";
        List<String> strings = FileUtils.readFile(fileName);
        System.out.println("strings:" +strings);
    }
}
